Developer --> Technical Publications

     


Setting and Obtaining Keychain Item Attribute Data

You can call the function KCSetAttribute or KCSetData to set or modify attribute data for a keychain item. If you call KCSetData, pass the length of the data to store and a pointer to that data.

If you call KCSetAttribute, pass a pointer to a KCAttribute structure in the attr parameter of this function. Fill in the tag , length, and data fields of the structure with the tag identifying the attribute you wish to modify, the length of the attribute data you wish to add, and a pointer to that data, respectively.

Standard item attributes which can be modified are identified by the tag constants kDescriptionKCItemAttr , kCommentKCItemAttr , kLabelKCItemAttr , kCreatorKCItemAttr , kTypeKCItemAttr , and kCustomIconKCItemAttr . See "Keychain Item Attribute Tag Constants" for a description of these constants. Each class of item has additional attributes specific to that class which may be changed. For a complete list, see "Keychain Item Attribute Tag Constants".

You can call the function KCGetAttribute or KCGetData to retrieve attribute data from a keychain item. If you call KCGetData, pass the length of the data buffer pointed to by the data parameter. KCGetData will pass back a pointer to the attribute data you requested and the actual length of that data.

If you call KCGetAttribute, pass a pointer to a KCAttribute structure in the attr parameter of this function. Before calling KCGetAttribute, fill in the tag, length , and data fields (the data field should contain a pointer to a buffer of sufficient length for the type of data to be returned). On return, KCGetAttribute fills in the data field with the requested attribute data.

Standard item attributes which can be retrieved are identified by the tag constants kClassKCItemAttr , kCreationDateKCItemAttr , kModDateKCItemAttr , kDescriptionKCItemAttr , kCommentKCItemAttr , kLabelKCItemAttr , kCreatorKCItemAttr , kScriptCodeKCItemAttr , and kCustomIconKCItemAttr . See "Keychain Item Attribute Tag Constants" for a description of these constants. Each class of item has additional attributes specific to that class which may be retrieved. For a complete list, see "Keychain Item Attribute Tag Constants".


© 2000 Apple Computer, Inc. (Last Updated 07 April 00)